<!--
 
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<link href="browser.css" type="text/css" rel="stylesheet">	
<script>

function OnZipSubmit()
{

	document.getElementById('frmZipUpload').action = window.parent.oConnector.sUrl + "&Command=ZipFileUpload";
	if (document.getElementById('NewFile').value.length == 0 )
	{
		alert( 'Please select a file from your computer' ) ;
		return false ;
	}

	// Set the interface elements.
	document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder (Upload in progress, please wait...)' ;
	document.getElementById('btnUpload').disabled = true ;
	
	return true ;
}


function OnUploadCompleted( errorNumber, data )
{
	// Reset the upload form (On IE we must do a little trick to avout problems).
	if ( document.all )
		document.getElementById('NewFile').outerHTML = '<input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file">' ;
	else
		document.getElementById('frmZipUpload').reset() ;
	
	// Reset the interface elements.
	document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder' ;
	document.getElementById('btnUpload').disabled = false ;
	
	switch ( errorNumber )
	{
		case 0 :
			//alert("Unziped file " + data);
			break;
		case 1 :	// Custom error.
			//alert(data) ;
			break ;
		case 201 :
			alert( 'A file with the same name is already available. The unipped file has been renamed to "' + data + '"' ) ;
			break ;
		case 202 :
			alert( 'Invalid unzipped file ' + data ) ;
			break ;
		default :
			alert( 'Error on unzipped upload. Error number: ' + errorNumber ) ;
			break ;
	}

}

function back(){
	window.parent.location = window.parent.oConnector.backUrl;
}

</script>
</head>
	<body bottomMargin="0" topMargin="0">
		<a href="javascript:back();"> << Back</a>
		<br/>
		<br/>
		<br/>
		<form id="frmZipUpload" target="frmUploadWorker" method="post" enctype="multipart/form-data" onsubmit="return OnZipSubmit();">
			<table cellSpacing="0" cellPadding="0" width="100%" border="1">
				<tr>
					<td>
						<span id="eUploadMessage">Upload a new zip file (it will be unziped on the current directory)</span><br>
						<table cellSpacing="0" cellPadding="0" width="100%">
							<tr>
								<td width="100%"><input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file"></td>
								<td nowrap>&nbsp;<input id="btnUpload" type="submit" value="Upload"></td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</form>		
	</body>
</html>
